//
//  OAMyInfoCell.m
//  OA项目
//
//  Created by innofive on 2018/4/25.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "OAMyInfoCell.h"

@implementation OAMyInfoCell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.text = model[@"title"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


@interface OAMyInfo1Cell()
@property(nonatomic,strong)UIImageView *imageV;
@end


@implementation OAMyInfo1Cell
//
-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    [super onAsInitAddView:view forViewController:ViewController forDataSource:dataSource AtIndexPath:indexPath];
//self.backgroundColor =[UIColor yellowColor];
    UIImageView *imageView = ({
        UIImageView *l = [UIImageView new];
        //l.backgroundColor =[UIColor redColor];
        [view addV:l];
        l;
    });
    _imageV = imageView;

    WSELF(weakSelf);
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.centerY = size.height/2;
        
        imageView.size = CGSizeMake(kFitW(40), kFitW(40));
        imageView.right = size.width-kFitW(30);
        imageView.centerY = size.height/2;
        NSLog(@"%@",NSStringFromCGRect(imageView.frame));
    }];
    

}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    _imageV.image =IMAGE(model[@"imageName"]);
    [super update:model forTableView:tableView AtIndexPath:indexPath];
    

    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end

@implementation OAMyInfo2Cell
//
//-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
//{
//    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//
//
//
//}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    [super update:model forTableView:tableView AtIndexPath:indexPath];
   
    self.detailTextLabel.text = model[@"title1"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end


@implementation OAMyInfo3Cell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    HLTextField *textF = ({
        HLTextField *l = [HLTextField new];
        l.placeholder = dataSource[@"title"];
        l.placeholderInsets = UIEdgeInsetsMake(0, kFitW(10), 0, 0);
        l.clearButtonMode = UITextFieldViewModeAlways;
        [view addV:l];
        l;
    });
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        textF.size = CGSizeMake(size.width-kFitW(10), size.height);
        textF.top = 0;
        textF.left = kFitW(10);
    }];
    
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end


@implementation OAMyInfo4Cell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    HLTextView *textV = ({
        HLTextView *l = [HLTextView new];
        l.placeholder = dataSource[@"title"];
        l.placeholderLabel.font = kSysFont(kFitW(13));
        [view addV:l];
        l;
    });
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        textV.size = CGSizeMake(size.width, size.height);
        textV.top = 0;
        textV.left = 0;
    }];
    
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end

@interface OAMyInfo5Cell()
@property(nonatomic,strong)HLTextField *textF;
@end

@implementation OAMyInfo5Cell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    HLTextField *textF = ({
        HLTextField *l = [HLTextField new];
        l.enabled = NO;
        l.placeholderInsets = UIEdgeInsetsMake(0, kFitW(10), 0, 0);
        l.clearButtonMode = UITextFieldViewModeAlways;
        [view addV:l];
        l;
    });
    _textF =textF;
    WSELF(weakSelf);
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.centerY = size.height/2;
        
        textF.size = CGSizeMake(size.width-kFitW(10), size.height);
        textF.top = 0;
        textF.left = weakSelf.textLabel.right+kFitW(20);
    }];
    
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
        _textF.placeholder = model[@"title1"];
        self.textLabel.text = model[@"title"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end

@interface OAMyInfo6Cell()
@property(nonatomic,strong)HLTextField *textF;
@end
@implementation OAMyInfo6Cell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    HLTextField *textF = ({
        HLTextField *l = [HLTextField new];
        l.placeholderFont = kSysFont(kFitW(13));
        l.placeholderInsets = UIEdgeInsetsMake(0, kFitW(10), 0, 0);
        l.clearButtonMode = UITextFieldViewModeAlways;
        [view addV:l];
        l;
    });
    _textF =textF;
    WSELF(weakSelf);
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.centerY = size.height/2;
        
        textF.size = CGSizeMake(size.width-kFitW(10), size.height);
        textF.top = 0;
        textF.left = weakSelf.textLabel.right+kFitW(15);
    }];
    
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    _textF.placeholder = model[@"title1"];
    self.textLabel.text = model[@"title"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end



@interface OAMyInfo7Cell()
@property(nonatomic,strong)UIButton *btn;
@end
@implementation OAMyInfo7Cell

-(void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(NSDictionary *)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    UIButton *btn = ({
        UIButton *l = [UIButton buttonWithType:UIButtonTypeCustom];
//        [l AddTarget:self Action:@selector(onClickButtonForSub:)];
        [l setNormalImage:IMAGE(@"button_Default_common")];
        [l setSelectImage:IMAGE(@"button_Selected_common")];
        [view addV:l];
        l;
    });
    _btn = btn;
    WSELF(weakSelf);
    [self onMainSetSubViewFrame:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {

        [btn sizeToFit];
        btn.left = kFitW(15);
        btn.centerY = size.height/2;
        
        [weakSelf.textLabel sizeToFit];
        weakSelf.textLabel.centerY = size.height/2;
        weakSelf.textLabel.left = btn.right+kFitW(10);
    }];
    
    
}

-(void)update:(NSDictionary *)model forTableView:(UITableView *)tableView AtIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.text = model[@"title"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    _btn.selected =selected;
    
}

@end

@implementation OAMyInfoHeaderView


-(void)update:(id)model forTableView:(UITableView *)tableView AtSection:(NSInteger)section
{
    self.textLabel.font = kSysFont(kFitW(13));
    self.textLabel.textColor = hexCOLOR(@"8D8D8D");
    self.textLabel.text = model;
}


@end
